from django.db import models

# Create your models here.

# 疫苗类别
class CategoryModels(models.Model):
    name = models.CharField(max_length=20, verbose_name='类别名称')
    description = models.TextField(verbose_name='类别描述', blank=True)
    
    def __str__(self):
        return self.name

    class Meta():
        db_table = 'category'
        verbose_name_plural = '类别'

# 疫苗信息
class VaccineModels(models.Model):
    name = models.CharField(max_length=100, verbose_name='疫苗名称')
    author = models.CharField(max_length=100, verbose_name='词条作者')
    reviewer = models.CharField(max_length=100, verbose_name='审核专家')
    description = models.TextField(verbose_name='疫苗简介')
    efficacy = models.TextField(verbose_name='功效作用')
    contraindications = models.TextField(verbose_name='用药禁忌')
    dosage = models.TextField(verbose_name='用法用量')
    adverse_reactions = models.TextField(verbose_name='不良反应')
    more_info = models.TextField(verbose_name='更多信息')
    Category = models.ManyToManyField(CategoryModels, verbose_name='疫苗')
    
    def __str__(self):
        return self.name

    class Meta():
        db_table = 'vaccine'
        verbose_name_plural = '疫苗信息'
